<html>
<title>为实例删除属性$delete</title>

<head>
    <script src="./js/vue.js"></script>

</head>

<body>
    <div class="container">
        <button @click="deleteAge">删除age属性</button>
        <button @click="deleteName">删除name属性</button>
        <h3>{{ user.name }}</h3>
        <br>
        <h3>{{ user.age }}</h3>
    </div>
    <script>
        var vm = new Vue({
            data: {
                user: {
                    name: "tom",
                    age: 18
                }
            },
            methods: {
                deleteAge() {
                    this.$delete(this.user,"age");
                },
                deleteName() {
                    Vue.delete(this.user, "name");
                }
            }
        }).$mount('.container');
    </script>
</body>

</html>